# 17级青软2班 李翔宇 17114120208
class ThreeDimensionalVector:
    def __init__(self, x, y, z):  # 定义构造方法
        self.__x = x  # 定义私有变量x,只有在类内部才可以访问
        self.__y = y  # 定义私有变量y,只有在类内部才可以访问
        self.__z = z  # 定义私有变量z,只有在类内部才可以访问

    def add(self, ThreeDimensionalVector):  # 定义加法运算
        ax = self.__x+ThreeDimensionalVector.__x
        ay = self.__y+ThreeDimensionalVector.__y
        az = self.__z+ThreeDimensionalVector.__z
        print(ax, ay, az)

    def sub(self, ThreeDimensionalVector):  # 定义减法法运算
        sx = self.__x-ThreeDimensionalVector.__x
        sy = self.__y-ThreeDimensionalVector.__y
        sz = self.__z-ThreeDimensionalVector.__z
        print(sx, sy, sz)

    def mul(self, a):  # 定义乘法法运算
        mx = self.__x*a
        my = self.__y*a
        mz = self.__z*a
        print(mx, my, mz)

    def div(self, b):  # 定义除法运算
        dx = self.__x/b
        dy = self.__y/b
        dz = self.__z/b
        print(dx, dy, dz)


v1 = ThreeDimensionalVector(3, 4, 5)  # 实例化对象
v2 = ThreeDimensionalVector(5, 6, 7)  # 实例化对象
v1.add(v2)  # 调用类方法
v1.sub(v2)  # 调用类方法
v1.mul(3)  # 调用类方法
v1.div(2)  # 调用类方法
